<template>
  <div>
    {{ $store.getters.userName }}
    <van-button @click="setUserName">设置名称</van-button>
  </div>
</template>

<script>
export default {
  name: 'vuestoretest',
  data() {
    return {
      userName: ''
    }
  },
  mounted() {
    this.$store.commit('SET_FIRSTNAME', 'Smith')
  },
  methods: {
    setUserName() {
      // this.userName = this.$store.getters.userName
      this.$store.commit('SET_FIRSTNAME', 'Smith-111')
    }
  }
}
</script>

<style>
</style>